package cn.wolfcode.rbac.domain;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
@Getter@Setter
public class Customertracehistory extends BaseDomain{
    //姓名
    private Customer customer;
    //跟进日期
    private String trace_time;
    //跟进内容
    private String trace_details;
    //跟进方式
    private SystemDictionaryItem traceType;
    //跟进结果
    private Integer trace_result;
    //录入人
    private Employee inputUser;
    private String remark;
    private String input_time;
    private int type;
    //获取页面中的data-json属性
    public String getJson(){
        HashMap<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("customer",customer);
        map.put("trace_time",trace_time);
        map.put("trace_details",trace_details);
        map.put("traceType",traceType);
        map.put("trace_result",trace_result);
        map.put("remark",remark);
        map.put("input_time",input_time);
        map.put("type",type);
        return JSON.toJSONString(map);
    }

    public String getDisplayTraceResult(){
            if(this.trace_result == 1){
                //差
                return "差";
            }else if(this.trace_result == 2){
                //中
                return "中";
            }else{
                //优
                return "优";
            }
    }
    //跟进类型
    public String getDisplayType() {
            if (type == 0) {
                //0表示潜在客户
                return "潜在客户";
            } else if(type == 1) {
                //1表示正式客户
                return "正式客户";
            } else if (type == 2) {
                //2表示资源池客户
                return "资源池客户";
            } else if (type == 3) {
                //3表示失败客户
                return "失败客户";
            } else if (type == 4) {
                //4表示流失客户
                return "流失客户";
            } else if (type == 11) {
                //11表示跟进历史
                return "跟进历史";
            } else {
                //22表移交历史
                return "移交历史";
            }
    }




}
